<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/23 0023
 * Time: 23:24
 */
//预备语句
$conn = mysqli_connect('localhost', 'root', 'root', 'test');


if (mysqli_connect_errno()) {
    die(mysqli_connect_error());
}

// $conn->query("CREATE TABLE alfas" .
//    " (`year` INTEGER, `model` VARCHAR(50), `accel` REAL)")or die('fail');
$stmt = $conn->prepare("INSERT INTO alfas (`year`,model,accel) VALUES (?, ?, ?)") or die('fail2');
$stmt->bind_param("isd",$year,$model,$accel);

$year = 2001;
$model = '156 2.0 Selespeed';
$accel ='8.6';

$stmt->execute();
$year = 2002;
$model = '157 2.0 Selespeed';
$accel ='8.6';

$stmt->execute();
$year = 2003;
$model = '158 2.0 Selespeed';
$accel ='8.6';

$stmt->execute();
//$result->free();
$conn->close();